﻿using System;
using Avalonia.Controls.Notifications;
using SukiUI.Toasts;

namespace NewUI.Component;

public class ToastManager
{
    public static void ShowSuccessToast(string message) => ShowTypeDemoToast(NotificationType.Success, message);
    
    public static void ShowWarningToast(string message) => ShowTypeDemoToast(NotificationType.Warning, message);
    
    public static void ShowErrorToast(string message) => ShowTypeDemoToast(NotificationType.Error, message);
    
    private static void ShowTypeDemoToast(NotificationType toastType,string message)
    {
        MainWindow.ToastManager.CreateToast()
            .WithTitle($"{toastType}!")
            .WithContent(message)
            .OfType(toastType)
            .Dismiss().After(TimeSpan.FromSeconds(3))
            .Dismiss().ByClicking()
            .Queue();
    }
}